American maths Olympiad Question